package com.melo;

import java.awt.*;
import java.util.Comparator;

/**
 * @Author lichunlong lcl253137@alibaba-inc.com
 * @Desc 棋盘坐标比较器: 比较每个坐标的下一步的选择数量
 * @Date 2025-06-12
 */
public class ChessboardPointComparator implements Comparator<Point> {

    @Override
    public int compare(Point p1, Point p2) {
        // 获取下一步的所有位置个数
        int p1NextChessboardPointListSize = HorseStepChessboard.calNextChessboardPoint(p1).size();
        int p2NextChessboardPointListSize = HorseStepChessboard.calNextChessboardPoint(p2).size();

        // 倒序排列
        return Integer.compare(p1NextChessboardPointListSize, p2NextChessboardPointListSize);
    }
}
